﻿/*using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Slaks.Graphs.Algorithms;
using DataInput;
using Slaks.Graphs.GraphBuilder;

namespace Slaks.Graphs.Analysis.ClusteringMeasures
{
    public class DunnIndex : ClusteringMeasureBase
    {
        private GraphDistanceBase m_graphDistanceMeasure;

        public override object evaluate(GraphList [] clusters, Slaks.Graphs.Category.CategoriesFile categoriesFile)
        {
            double dMin = double.MaxValue;
            double dMax = double.MinValue;

            double distance;

            Graph graph1, graph2;

            GraphDistanceBase dist = m_graphDistanceMeasure.clone();

            //compute maximum distance between any two items in the same cluster
            for (int i = 0; i < clusters.Length; i++)
            {
                for (int j = 0; j < clusters[i].Count; j++)
                {
                    graph1 = clusters[i][j];
                    for (int k = j + 1; k < clusters[i].Count; k++)
                    {
                        graph2 = clusters[i][k];
                        dist.firstGraph = graph1;
                        dist.secondGraph = graph2;
                        distance = dist.GetDistance();
                        if (dMax < distance) dMax = distance;
                    }
                }
            }

            //compute minimum distance between any two items in different clusters
            for (int i = 0; i < clusters.Length - 1; i++)
            {
                for (int j = 0; j < clusters[i].Count; j++)
                {
                    graph1 = clusters[i][j];
                    for (int k = 0; k < clusters.Length; k++)
                    {
                        if (k == i) continue; //clusters must be different

                        for (int m = 0; m < clusters[k].Count; m++)
                        {
                            graph2 = clusters[k][m];
                            dist.firstGraph = graph1;
                            dist.secondGraph = graph2;
                            distance = dist.GetDistance();
                            if (dMin > distance) dMin = distance;
                        }
                    }
                }
            }

            double dunnIndex = (dMin != 0) ? (dMin / dMax) : dMin;

            return dunnIndex;   
        }


        public virtual List<Field> GetDynamicFields(IRepresentation BT)
        {
            List<Field> fields = base.GetDynamicFields(BT);
            string[] DA = DistanceAlgFactory.Instance.GetSuitableDistanceAlgorithms(BT);
            Dictionary<string, object> distanceAlgorithms = new Dictionary<string, object>();
            for (int i = 0; i < DA.Length; i++)
                distanceAlgorithms.Add(DA[i], DA[i]);
            if (DA.Length > 0)
                fields.Add(new ListField(GraphDistanceBase.DistanceAlgorithmParam, "Distance Algorithm:", DA[0], distanceAlgorithms, false));
            return fields;
        }

        public override void SetDynamicValues(IEnumerable<Field> fields)
        {
            foreach (var field in fields)
            {
                if (field.FieldName == GraphDistanceBase.DistanceAlgorithmParam)
                    m_graphDistanceMeasure = DistanceAlgFactory.Instance.GetInstance(field.Value.ToString());
            }
        }

        public override string getMeasureName()
        {
            return "DunnIndex";
        }
    }
}
*/